home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH6 / 6-1-2.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-02  |  2.4 KB  |  82 lines

  1. VERSION 5.00
  2. Begin VB.Form frm6_1_2 
  3.    Caption         =   "Read File"
  4.    ClientHeight    =   2595
  5.    ClientLeft      =   690
  6.    ClientTop       =   1815
  7.    ClientWidth     =   3750
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   2595
  20.    ScaleWidth      =   3750
  21.    Begin VB.PictureBox picItem 
  22.       Height          =   375
  23.       Left            =   120
  24.       ScaleHeight     =   315
  25.       ScaleWidth      =   3555
  26.       TabIndex        =   3
  27.       Top             =   2040
  28.       Width           =   3615
  29.    End
  30.    Begin VB.CommandButton cmdDisplay 
  31.       Caption         =   "Display First Item of File"
  32.       Default         =   -1  'True
  33.       Height          =   495
  34.       Left            =   120
  35.       TabIndex        =   2
  36.       Top             =   1320
  37.       Width           =   3255
  38.    End
  39.    Begin VB.TextBox txtName 
  40.       Height          =   285
  41.       Left            =   1320
  42.       TabIndex        =   1
  43.       Top             =   840
  44.       Width           =   2055
  45.    End
  46.    Begin VB.Label lblFiles 
  47.       Caption         =   "The available files are: HUMOR.TXT, INSULTS.TXT, and SECRET.TXT."
  48.       Height          =   375
  49.       Left            =   120
  50.       TabIndex        =   4
  51.       Top             =   120
  52.       Width           =   3255
  53.    End
  54.    Begin VB.Label lblName 
  55.       Caption         =   "Name of file to open"
  56.       Height          =   495
  57.       Left            =   120
  58.       TabIndex        =   0
  59.       Top             =   720
  60.       Width           =   1095
  61.    End
  62. Attribute VB_Name = "frm6_1_2"
  63. Attribute VB_GlobalNameSpace = False
  64. Attribute VB_Creatable = False
  65. Attribute VB_PredeclaredId = True
  66. Attribute VB_Exposed = False
  67. Private Sub cmdDisplay_Click()
  68.   Dim passWord As String, info As String
  69.   If UCase(txtName.Text) = "SECRET.TXT" Then
  70.       passWord = ""
  71.       Do While passWord <> "SHAZAM"
  72.         passWord = InputBox("What is the password?")
  73.         passWord = UCase(passWord)
  74.       Loop
  75.   End If
  76.   Open App.Path & "\" & txtName.Text For Input As #1
  77.   Input #1, info
  78.   picItem.Cls
  79.   picItem.Print info
  80.   Close #1
  81. End Sub
  82.